package com.xxx.controller;


import com.xxx.config.Request;
import com.xxx.pojo.Label;
import com.xxx.pojo.Type;
import com.xxx.service.TypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author George
 * @since 2023-07-06
 */
@RestController
@RequestMapping("/type")
public class TypeController {

    @Resource
    private TypeService typeService;

    /**
     * 查询所有标签
     *
     * @return 返回用户列表和总数
     */
    @ApiOperation(value = "查询商品类型", notes = "查询所有商品类型")
    @GetMapping("/typeList")
    public Request getQueryLabel(){
        List<Type> list = typeService.list();
        return list.size() > 0 ? Request.suc(list) : Request.error("查询失败");
    }

}

